package chapter9;

class Account {
	private int balance =50;
	public int getBalance(){
		return balance;
	}
	public void withdraw(int amount){
		balance-=amount;
	}
	@Override
	public int hashCode() {
		final int PRIME = 31;
		int result = 1;
		result = PRIME * result + balance;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Account other = (Account) obj;
		if (balance != other.balance)
			return false;
		return true;
	}
}
